import Router from 'koa-router';
import Mock from 'mockjs';

const mockRoute = new Router();

// user info
mockRoute.get('/api/user', ctx => {
    ctx.status = 200;
    ctx.body = Mock.mock({
        displayName: '@string(lower, 8)'
    });
});

// exampl list
mockRoute.get('/api/list', ctx => {
	ctx.status = 200;
	ctx.body = Mock.mock({
		'list|10': [
			{
				'name': '@string(lower, 8)',
                'startime': '@date("yyyy-MM-dd")',
                'endtime': '@date("yyyy-MM-dd")',
                'teacher': '李波'
			}
		]
	})
});

// start docker
mockRoute.get('/api/startexperiment', ctx => {
    ctx.status = 200;
    ctx.body = Mock.mock({
        displayName: '@string(lower, 8)'
    });
});

// stop docker
mockRoute.get('/api/stopexperiment', ctx => {
    ctx.status = 200;
    ctx.body = Mock.mock({
        displayName: '@string(lower, 8)'
    });
});

// show web info state
mockRoute.get('/api/webinfo', ctx => {
    ctx.status = 200;
    ctx.body = Mock.mock({
        displayName: '@string(lower, 8)'
    });
});

// submit experiment
mockRoute.get('/api/submitexperiment', ctx => {
    ctx.status = 200;
    ctx.body = Mock.mock({
        displayName: '@string(lower, 8)'
    });
});

// grade 文件系统读取
mockRoute.get('/api/grade', ctx => {
    ctx.status = 200;
    ctx.body = Mock.mock({
        'list|10': [
			{
                'name': '@string(lower, 8)',
                'stdnum': '5120155818',
                'time': '@date("yyyy-MM-dd")',
                'teacher': 'libo',
				'grade': '@integer(60, 100)'
			}
		]
    });
});
export default mockRoute;
